;; core/global.scm - (c) rohan drape, 2000-2005

;; This provides the `parameter' interface for actual global
;; variables.

(define (make-global init)
  (let ((value init))
    (lambda arguments
      (if (null? arguments)
	  value
	  (set! value (car arguments))))))

;; Syntax to define global variables.

(define-syntax define-global
  (syntax-rules ()
    ((_ name) (define name (make-global #f)))
    ((_ name init) (define name (make-global init)))))
